﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace yinyue
{
 public   class HistoricalPlay
    {
     private static HistoricalPlay historical = null;
     private static List<Songlist> list = new List<Songlist>();
     private HistoricalPlay() { }
     public static HistoricalPlay getHistoricalPlay()
        {
            if (historical == null)
            {
                historical = new HistoricalPlay();
            }
            return historical;
        }
     public void addSong(Songlist song) 
     {
         try
         {
             if (list == null)
             {
                 list.Add(song);
                 return;
             }
             foreach (var item in list)
             {
                 if (item.songid == song.songid)
                 {
                     return;
                 }
             }
             list.Add(song);
         }
         catch (Exception)
         {
             
             throw;
         }
     }
     public List<Songlist> getList() 
     {
         return list;
     }
     public List<Songlist> deleteList(int id)
     {
         List<Songlist> song = new List<Songlist>();
         foreach (var item in list)
         {
             if (id == item.songid)
             {
                 list.Remove(item);
                 song = list;
                 break;
             }
         }
         return song;
     }
    }
}
